<?php
/**
 * $Id: statement.php 11 2010-11-24 22:10:53Z LEON $
 * $Author: LEON $
 * $LastChangedDate: 2010-11-24 22:10:53 +0000 (Wed, 24 Nov 2010) $
 * $Revision: 11 $
 */
namespace cmFly\db\PDO;
class statement extends \PDOStatement implements \cmFly\db\iStatement {
	/**
	 *
	 * @param mixed $parameters
	 * @return \cmFly\db\PDO\statement
	 */
	protected $fetch_mode;
	public function execute($parameters = null) {
		if(!is_array($parameters)) {
			$parameters=func_get_args();
		}
		return parent::execute($parameters);
	}
	public function fetch($fetch_style = \PDO::FETCH_BOTH, $cursor_orientation = \PDO::FETCH_ORI_NEXT, $cursor_offset = \PDO::FETCH_ORI_ABS) {
		return parent::fetch($fetch_style, $cursor_orientation, $cursor_offset);
	}
	public function setFetchMode($mode,$opt1=NULL,$opt2=NULL) {
	    $bool=false;
	    if($opt1 && !$opt2) {
		$bool=parent::setFetchMode($mode,$opt1);
	    }
	    elseif($opt1) {
		$bool=parent::setFetchMode($mode,$opt1,$opt2);
	    }
	    elseif($opt2) {
		throw new \cmFly\system\exceptions\fatal('$opt1 not setted in setFetchMode!');
	    }
	    else {
		$bool=parent::setFetchMode($mode);
	    }
	    if($bool) {
		$this->fetch_mode=$mode;
	    }
	    return $bool;
	}
	public function getFetchMode() {
	    return $this->fetch_mode;
	}
}
